home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / weeklydump / RCS / weeklydump,v < prev    next >
Encoding:
Text File  |  1992-08-04  |  8.0 KB  |  433 lines

  1. head     1.13;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    mottsmth:1.13; strict;
  6. comment  @# @;
  7.  
  8.  
  9. 1.13
  10. date     91.10.09.16.31.35;  author jhh;  state Exp;
  11. branches ;
  12. next     1.12;
  13.  
  14. 1.12
  15. date     91.09.28.15.56.54;  author kupfer;  state Exp;
  16. branches ;
  17. next     1.11;
  18.  
  19. 1.11
  20. date     91.09.28.14.59.54;  author shirriff;  state Exp;
  21. branches ;
  22. next     1.10;
  23.  
  24. 1.10
  25. date     91.09.04.12.30.57;  author jhh;  state Exp;
  26. branches ;
  27. next     1.9;
  28.  
  29. 1.9
  30. date     91.09.04.12.29.32;  author shirriff;  state Exp;
  31. branches ;
  32. next     1.8;
  33.  
  34. 1.8
  35. date     91.08.26.12.04.55;  author kupfer;  state Exp;
  36. branches ;
  37. next     1.7;
  38.  
  39. 1.7
  40. date     91.08.26.11.48.02;  author shirriff;  state Exp;
  41. branches ;
  42. next     1.6;
  43.  
  44. 1.6
  45. date     91.07.11.13.47.08;  author shirriff;  state Exp;
  46. branches ;
  47. next     1.5;
  48.  
  49. 1.5
  50. date     91.05.05.14.02.13;  author tve;  state Exp;
  51. branches ;
  52. next     1.4;
  53.  
  54. 1.4
  55. date     91.05.02.21.48.57;  author root;  state Exp;
  56. branches ;
  57. next     1.3;
  58.  
  59. 1.3
  60. date     91.05.02.18.46.30;  author mottsmth;  state Exp;
  61. branches ;
  62. next     1.2;
  63.  
  64. 1.2
  65. date     91.04.01.14.18.24;  author jhh;  state Exp;
  66. branches ;
  67. next     1.1;
  68.  
  69. 1.1
  70. date     90.12.16.22.16.50;  author kupfer;  state Exp;
  71. branches ;
  72. next     ;
  73.  
  74.  
  75. desc
  76. @Script to do weekly full dumps.
  77. @
  78.  
  79.  
  80. 1.13
  81. log
  82. @back to using dump
  83. @
  84. text
  85. @#! /sprite/cmds/csh -f
  86. #
  87. #   weeklydump [ startFs ]
  88. #
  89. #    Perform a weekly, level 0, dump.
  90. #    Dump all the filesystems that we want backed up.  If startFs
  91. #    is specified, we start dumping with that file system,
  92. #    presumably because the ones ahead of it in the list were
  93. #    already dumped.
  94. #
  95. # $Header: /sprite/src/admin/weeklydump/RCS/weeklydump,v 1.12 91/09/28 15:56:54 kupfer Exp Locker: jhh $
  96. #
  97.  
  98. # This is our exit status.
  99. set result=0
  100.  
  101. set tapeDrives = `grep -v '^#' /sprite/admin/dump/tapelist`
  102. if ($#tapeDrives < 1) then
  103.     echo "No tape drives in /sprite/admin/dump/tapelist?"
  104.     exit -1
  105. endif
  106.  
  107. set dump = dump
  108.  
  109. # Tell the world what's happening
  110. touch /sprite/admin/dump/doingweekly
  111. if ( $USER == "root") then
  112.     touch /sprite/admin/dump/dumpalias
  113.     echo -n '$USER' "is root, so /sprite/admin/dump/dumpalias will remain "
  114.     cat /sprite/admin/dump/dumpalias
  115. else
  116.     echo $USER >! /sprite/admin/dump/dumpalias
  117. endif
  118.  
  119. # This is the list of filesystems that we want to dump.
  120. set filesystems=(`cat /sprite/admin/dump/dumplist`)
  121.  
  122. # If the user says to reinitialize the tape, do it.
  123. if ($#argv > 0) then
  124.     if ("$argv[1]" == "-i") then
  125.     set goodTape = ()
  126.     foreach tape ($tapeDrives)
  127.         echo "initializing" $tape
  128.         $dump -s -f $tape
  129.         set stat = $status
  130.         if ($stat == 123) then
  131.         echo "Init: tape recently used"
  132.         exit
  133.         else if ($stat != 0) then
  134.         echo "Init failed on tape $tape"
  135.         else
  136.         set goodTape = ($goodTape $tape)
  137.         endif
  138.     end
  139.     shift
  140.     set tapeDrives=($goodTape)
  141.     endif
  142. endif
  143.  
  144. set drivesLeft=($tapeDrives)
  145.  
  146. if ($#drivesLeft == 0) then
  147.     echo "No good tape drives"
  148.     exit
  149. endif
  150.  
  151. echo "Tape drive list: $drivesLeft"
  152.  
  153. # If the user specified a starting filesystem, skip over the ones in
  154. # front of it.
  155.  
  156. set start = ""
  157.  
  158. if ($#argv > 0) then
  159.     set start = "$argv[1]"
  160. else
  161.     set start = `cat /sprite/admin/dump/doingweekly`
  162. endif
  163. if ("$start" != "") then
  164.     while (_$filesystems[1] != _$start)
  165.         if ($#filesystems == 1) then
  166.             echo $start "isn't in the list of filesystems."
  167.             echo $start "isn't in the list of filesystems. |\
  168.                 mail -s "Dump error" dumper
  169.             exit 1
  170.         endif
  171.         shift filesystems
  172.     end
  173.     echo "Starting with filesystem $start"
  174. endif
  175.  
  176. /sprite/cmds/hostname >! /sprite/admin/dump/doingweekly.active
  177.  
  178. # Run through the list of filesystems.  When we get to a dump that
  179. # fails, we assume it's because the tape filled up, so switch to the
  180. # next tape.  If we run out of tapes, send mail to the dumper with the
  181. # name of the next filesystem to be dumped.
  182.  
  183. while ($#filesystems > 0)
  184.     set fs=$filesystems[1]
  185.     set tape=$drivesLeft[1]
  186.     echo $fs >! /sprite/admin/dump/doingweekly
  187.     $dump -f $tape -l 0 $fs
  188.     if ($status == 0) then
  189.         shift filesystems
  190.         continue
  191.     endif
  192.  
  193.     # Try to switch to another tape and retry the same filesystem.
  194.     if ($#drivesLeft > 1) then
  195.         shift drivesLeft
  196.     else
  197.         (echo "Please insert new tape(s) and resume with $fs :" ;\
  198.         echo "weeklydump -i $fs") | \
  199.           mail -s "Dumps not completed" dumper
  200.         set result=1
  201.         break
  202.     endif
  203. end
  204.  
  205. # Rewind the tapes.
  206.  
  207. foreach tape ($tapeDrives)
  208.     tape -r -t $tape
  209. end
  210.  
  211. if ($result == 0) then
  212.     (echo "Dump done.  Put in new tape for daily dump and do:" ; \
  213.     echo "dailydump -i") | mail -s "Dump done" dumper
  214.     echo "" >! /sprite/admin/dump/doingweekly
  215. endif
  216.  
  217. rm -f /sprite/admin/dump/doingweekly.active
  218.  
  219. exit $result
  220. @
  221.  
  222.  
  223. 1.12
  224. log
  225. @Store the name of the host running the dumps in the .active file.
  226. @
  227. text
  228. @d11 1
  229. a11 1
  230. # $Header: /sprite/src/admin/weeklydump/RCS/weeklydump,v 1.11 91/09/28 14:59:54 shirriff Exp Locker: kupfer $
  231. d23 2
  232. a24 1
  233. set dump = dump.new
  234. @
  235.  
  236.  
  237. 1.11
  238. log
  239. @Tape list comes from file, rather than being hard-wired into the
  240. script.  (Mike checking in for Ken.)
  241. @
  242. text
  243. @d11 1
  244. a11 1
  245. # $Header: /sprite/src/admin/weeklydump/RCS/weeklydump,v 1.10 91/09/04 12:30:57 jhh Exp $
  246. d91 1
  247. a91 1
  248. touch /sprite/admin/dump/doingweekly.active
  249. d113 1
  250. a113 1
  251.         echo "/sprite/admin.sun4/weeklydump -i $fs") | \
  252. d128 1
  253. a128 1
  254.     echo "/sprite/admin.sun4/dailydump -i") | mail -s "Dump done" dumper
  255. @
  256.  
  257.  
  258. 1.10
  259. log
  260. @now uses exb3 (exb-8500)
  261. @
  262. text
  263. @d11 1
  264. a11 1
  265. # $Header: /sprite/src/admin/weeklydump/RCS/weeklydump,v 1.9 91/09/04 12:29:32 shirriff Exp Locker: jhh $
  266. d17 7
  267. a23 1
  268. set $dump = dump.new
  269. a36 4
  270. # This is the list of tape drives we have to dump to.
  271. set tapeDrives=(/dev/exb3.nr)
  272.  
  273.  
  274. d114 1
  275. a114 1
  276.           mail -s "Dump ran out of tapes" dumper
  277. @
  278.  
  279.  
  280. 1.9
  281. log
  282. @checking this in for ken -- jhh
  283. @
  284. text
  285. @d11 1
  286. a11 1
  287. # $Header: /sprite/src/admin/weeklydump/RCS/weeklydump,v 1.8 91/08/26 12:04:55 kupfer Exp Locker: shirriff $
  288. d17 1
  289. d32 1
  290. a32 1
  291. set tapeDrives=(/dev/exb1.nr /dev/exb2.nr)
  292. d41 1
  293. a41 1
  294.         dump -s -f $tape
  295. d100 1
  296. a100 1
  297.     dump -f $tape -l 0 $fs
  298. @
  299.  
  300.  
  301. 1.8
  302. log
  303. @Put the argv[1] test in quotes, so that "weeklydump /" will work.
  304. @
  305. text
  306. @d11 1
  307. a11 1
  308. # $Header: /sprite/src/admin/weeklydump/RCS/weeklydump,v 1.7 91/08/26 11:48:02 shirriff Exp Locker: kupfer $
  309. d19 7
  310. a25 1
  311. echo $USER >! /sprite/admin/dump/dumpalias
  312. @
  313.  
  314.  
  315. 1.7
  316. log
  317. @Added exb2 to the list of drives.
  318. @
  319. text
  320. @d11 1
  321. a11 1
  322. # $Header: /sprite/src/admin/weeklydump/RCS/weeklydump,v 1.6 91/07/11 13:47:08 shirriff Exp Locker: shirriff $
  323. d30 1
  324. a30 1
  325.     if ($argv[1] == "-i") then
  326. @
  327.  
  328.  
  329. 1.6
  330. log
  331. @mary's change since we only have one drive right now.
  332. @
  333. text
  334. @d11 1
  335. a11 1
  336. # $Header: /sprite/src/admin/weeklydump/RCS/weeklydump,v 1.5 91/05/05 14:02:13 tve Exp Locker: shirriff $
  337. d25 1
  338. a25 1
  339. set tapeDrives=(/dev/exb1.nr)
  340. @
  341.  
  342.  
  343. 1.5
  344. log
  345. @removed /pcs/vlsi.old
  346. @
  347. text
  348. @d11 1
  349. a11 1
  350. # $Header: /sprite/src/admin/weeklydump/RCS/weeklydump,v 1.4 91/05/02 21:48:57 root Exp Locker: tve $
  351. d17 4
  352. d22 1
  353. a22 3
  354. set filesystems=(/ /user6 /scratch5 /scratch6 /pcs /pcs/vlsi \
  355.   /user1 /sprite/src/kernel /sprite/src /user2 /user4 /X11 /local /scratch1 \
  356.   /postdev /graphics /scratch4)
  357. d25 25
  358. a49 1
  359. set tapeDrives=(/dev/exb1.nr /dev/exb2.nr)
  360. d52 7
  361. d62 2
  362. d65 6
  363. a70 1
  364.     while (_$filesystems[1] != _$argv[1])
  365. d72 3
  366. a74 1
  367.             echo $argv[1] "isn't in the list of filesystems."
  368. d79 1
  369. d82 2
  370. d92 1
  371. d103 2
  372. a104 1
  373.         echo "Please resume with $fs" | \
  374. d116 8
  375. @
  376.  
  377.  
  378. 1.4
  379. log
  380. @changed /pcs/scratch to /pcs/vlsi.old
  381. @
  382. text
  383. @d11 1
  384. a11 1
  385. # $Header: /sprite/src/admin/weeklydump/RCS/weeklydump,v 1.3 91/05/02 18:46:30 mottsmth Exp Locker: root $
  386. d18 1
  387. a18 1
  388. set filesystems=(/ /user6 /scratch5 /scratch6 /pcs /pcs/vlsi /pcs/vlsi.old \
  389. @
  390.  
  391.  
  392. 1.3
  393. log
  394. @/user5 is gone. /user6 replaces it.
  395. @
  396. text
  397. @d11 1
  398. a11 1
  399. # $Header: /sprite/src/admin/weeklydump/RCS/weeklydump,v 1.1 90/12/16 22:16:50 kupfer Exp Locker: jhh $
  400. d18 2
  401. a19 2
  402. set filesystems=(/ /user6 /scratch5 /scratch6 /pcs /pcs/scratch /pcs/vlsi /user1 \
  403.   /sprite/src/kernel /sprite/src /user2 /user4 /X11 /local /scratch1 \
  404. @
  405.  
  406.  
  407. 1.2
  408. log
  409. @updated with new filesystem organization
  410. @
  411. text
  412. @d18 1
  413. a18 1
  414. set filesystems=(/ /user5 /pcs /pcs/scratch /pcs/vlsi /user1 \
  415. @
  416.  
  417.  
  418. 1.1
  419. log
  420. @Initial revision
  421. @
  422. text
  423. @d11 1
  424. a11 1
  425. # $Header$
  426. d18 1
  427. a18 1
  428. set filesystems=(/ /user5 /pcs /pcs/tic /pcs/vlsi /user1 \
  429. d20 1
  430. a20 1
  431.   /scratch3 /postdev /graphics)
  432. @
  433.